\(\int \frac {\sin (x)}{i+\cot (x)} \, dx\) [4]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 11, antiderivative size = 25 \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=\frac {2}{3} i \cos (x)+\frac {i \sin (x)}{3 (i+\cot (x))} \]

[Out]

2/3*I*cos(x)+1/3*I*sin(x)/(I+cot(x))

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3583, 2718} \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=\frac {2}{3} i \cos (x)+\frac {i \sin (x)}{3 (\cot (x)+i)} \]

[In]

Int[Sin[x]/(I + Cot[x]),x]

[Out]

((2*I)/3)*Cos[x] + ((I/3)*Sin[x])/(I + Cot[x])

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3583

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[a*(d*
Sec[e + f*x])^m*((a + b*Tan[e + f*x])^n/(b*f*(m + 2*n))), x] + Dist[Simplify[m + n]/(a*(m + 2*n)), Int[(d*Sec[
e + f*x])^m*(a + b*Tan[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, m}, x] && EqQ[a^2 + b^2, 0] && LtQ[n
, 0] && NeQ[m + 2*n, 0] && IntegersQ[2*m, 2*n]

Rubi steps \begin{align*} \text {integral}& = \frac {i \sin (x)}{3 (i+\cot (x))}-\frac {2}{3} i \int \sin (x) \, dx \\ & = \frac {2}{3} i \cos (x)+\frac {i \sin (x)}{3 (i+\cot (x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.09 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.08 \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=\frac {1}{6} (i \cos (x)+\sin (x)) (3+\cos (2 x)+2 i \sin (2 x)) \]

[In]

Integrate[Sin[x]/(I + Cot[x]),x]

[Out]

((I*Cos[x] + Sin[x])*(3 + Cos[2*x] + (2*I)*Sin[2*x]))/6

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.76

method result size
risch \(-\frac {i {\mathrm e}^{-3 i x}}{12}+\frac {3 i \cos \left (x \right )}{4}+\frac {\sin \left (x \right )}{4}\) \(19\)
default \(-\frac {1}{2 \left (\tan \left (\frac {x}{2}\right )+i\right )}-\frac {i}{\left (-i+\tan \left (\frac {x}{2}\right )\right )^{2}}+\frac {2}{3 \left (-i+\tan \left (\frac {x}{2}\right )\right )^{3}}+\frac {1}{-2 i+2 \tan \left (\frac {x}{2}\right )}\) \(47\)
norman \(\frac {\frac {2 i \tan \left (x \right )^{2}}{3}-\frac {i \tan \left (\frac {x}{2}\right )^{2}}{3}-\frac {\tan \left (x \right ) \tan \left (\frac {x}{2}\right )^{2}}{3}+\frac {2 \tan \left (x \right )^{2} \tan \left (\frac {x}{2}\right )}{3}+\frac {4 i \tan \left (x \right ) \tan \left (\frac {x}{2}\right )}{3}+\frac {\tan \left (x \right )}{3}-\frac {2 \tan \left (\frac {x}{2}\right )}{3}+i}{\left (1+\tan \left (\frac {x}{2}\right )^{2}\right ) \left (\tan \left (x \right )^{2}+1\right )}\) \(78\)

[In]

int(sin(x)/(I+cot(x)),x,method=_RETURNVERBOSE)

[Out]

-1/12*I*exp(-3*I*x)+3/4*I*cos(x)+1/4*sin(x)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.80 \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=\frac {1}{12} \, {\left (3 i \, e^{\left (4 i \, x\right )} + 6 i \, e^{\left (2 i \, x\right )} - i\right )} e^{\left (-3 i \, x\right )} \]

[In]

integrate(sin(x)/(I+cot(x)),x, algorithm="fricas")

[Out]

1/12*(3*I*e^(4*I*x) + 6*I*e^(2*I*x) - I)*e^(-3*I*x)

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.04 \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=\frac {i e^{i x}}{4} + \frac {i e^{- i x}}{2} - \frac {i e^{- 3 i x}}{12} \]

[In]

integrate(sin(x)/(I+cot(x)),x)

[Out]

I*exp(I*x)/4 + I*exp(-I*x)/2 - I*exp(-3*I*x)/12

Maxima [F(-2)]

Exception generated. \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate(sin(x)/(I+cot(x)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 37 vs. \(2 (15) = 30\).

Time = 0.25 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.48 \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=-\frac {1}{2 \, {\left (\tan \left (\frac {1}{2} \, x\right ) + i\right )}} + \frac {3 \, \tan \left (\frac {1}{2} \, x\right )^{2} - 12 i \, \tan \left (\frac {1}{2} \, x\right ) - 5}{6 \, {\left (\tan \left (\frac {1}{2} \, x\right ) - i\right )}^{3}} \]

[In]

integrate(sin(x)/(I+cot(x)),x, algorithm="giac")

[Out]

-1/2/(tan(1/2*x) + I) + 1/6*(3*tan(1/2*x)^2 - 12*I*tan(1/2*x) - 5)/(tan(1/2*x) - I)^3

Mupad [B] (verification not implemented)

Time = 12.76 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.24 \[ \int \frac {\sin (x)}{i+\cot (x)} \, dx=-\frac {\frac {4}{3}+\frac {\mathrm {tan}\left (\frac {x}{2}\right )\,8{}\mathrm {i}}{3}}{{\left (1+\mathrm {tan}\left (\frac {x}{2}\right )\,1{}\mathrm {i}\right )}^3\,\left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )} \]

[In]

int(sin(x)/(cot(x) + 1i),x)

[Out]

-((tan(x/2)*8i)/3 + 4/3)/((tan(x/2)*1i + 1)^3*(tan(x/2) + 1i))